package com.rrd.dw.mr.gzip.kafka;

import com.ucredit.babel.common.model.BaseModel;
import com.ucredit.babel.common.model.RecordType;
import com.ucredit.babel.common.model.xinyisou.XinYiSouWanXiang16394Record;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * 信易搜万象分16394
 *
 * @author guoqiang
 */

public class XinYiSouWanXiang16394Parse extends ParseBase {
    Text key = new Text();
    Text value = new Text();

    @Override
    public boolean parseJob(Mapper.Context context, BaseModel<?> model, String successful) throws IOException, InterruptedException {
        XinYiSouWanXiang16394Record obj = (XinYiSouWanXiang16394Record) model;
        StringBuilder sb = getBaseInfo(obj, successful);
        sb.append(obj.getName()).append(CRT001);
        sb.append(obj.getMsg()).append(CRT001);
        sb.append(obj.getCode()).append(CRT001);
        sb.append(obj.getRequestId()).append(CRT001);
        sb.append(obj.getWanxiang16394()).append(CRT001);
        key.set(getKey());
        value.set(sb.toString().replace("\n", " ").replace("\r", " "));
        context.write(key, value);
        return true;
    }

    @Override
    public String getTableName() {
        return "kafka_babel_xinyisou_wanxiang16394_score_inc";
    }

    @Override
    public String getType() {
        return RecordType.XINYISOU_WANXIANG16394_SCORE_RECORD.toString();
    }

    @Override
    public String getComment() {
        return "信易搜万象分16394";
    }
}
